package net.projecteuler.problem7;

public class PrimeNumber {
	
	public boolean isPrime(long testNumber) {
		if(testNumber == 1) return false;
		for (int i = 2; i < testNumber; i++) {
			if(testNumber % i == 0) {
				return false;
			}
		}
		return true;
	}
	
	public long getPrime(int serial) {
		int count = 0;
		long testNumber = 1;
		while (count <= serial) {
			if(isPrime(testNumber)) {
				count++;
				if(count == serial) {
					return testNumber;
				}
			}
			
			testNumber++;
		}
		return -1;
	}
}
